/**
  ******************************************************************************
  * @file    bsp.h
  * @author  Iron
  * @date    2018-08-03
  * @version v1.0
  * @brief   bsp header file
  */

#ifndef __BSP_H
#define __BSP_H

#ifdef __cplusplus
extern "C" {
#endif

/* includes ------------------------------------------------------------------*/
#include <stdint.h>
#include "FreeRTOS.h"

/* exported types ------------------------------------------------------------*/
/* exported constants --------------------------------------------------------*/
/* exported macro ------------------------------------------------------------*/

#if defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
#ifndef __weak
#define __weak   __attribute__((weak))
#endif /* __weak */
#ifndef __packed
#define __packed __attribute__((__packed__))
#endif /* __packed */
#endif /* __GNUC__ */

/* BSP CLI config ----------------------------------------------------------- */

#if !defined(APP_RELEASE_VERSION)
#define BSP_CLI_ENABLE
#endif

/* I2C config --------------------------------------------------------------- */
// #define BSP_I2C_ENABLE

/* exported functions ------------------------------------------------------- */
void _Error_Handler(char *file, int line);
void SystemClock_Config(void);

#ifdef BSP_CLI_ENABLE
int32_t bsp_puts(const char *s);
int32_t bsp_getc(void);
void bsp_putc(char ch);
#else
#define bsp_puts(s)
#define bsp_getc()  (-1)
#endif

void bsp_us_delay(uint32_t us);
void bsp_os_delay(uint32_t ms);

uint32_t bsp_get_time_ms(void);

void bsp_system_reboot(uint32_t delay_ms);

void bsp_init(void);

/**
  * @}
  */

#ifdef __cplusplus
}
#endif

#endif /* __BSP_H */

/******************* (C)COPYRIGHT 2018 ***** END OF FILE *********************/
